#!/bin/bash
# Scalable-Only-Builder




#start the script
echo "Building a new scalable-only release.";
echo;

echo -n "Preparing.(1 of 4).................................";
cd ../ #moving out of working copy
mkdir $THEME; #create UltimateGnome dir
cp -f -p $ICONFILESDIR/scalable/index.theme $THEME/index.theme; #index.theme for PNG version
cp -f -p $PROJECT/GPL $THEME/GPL; #copying license
cd $THEME; #move to exporting dir
mkdir scalable; #create main flder
cd scalable; #create subdirectories
for folder in $FOLDERS
do
	mkdir $folder;
done
cd ..
echo "[DONE]";

echo -n "Exporting files.(2 of 4)...........................";
cd ../$ICONFILESDIR;
FILES=`find ./scalable -name *.icon`                        
for file in $FILES
do
	cp -f -p -R $file ../../$THEME/$file;
done
cd ../$SOURCES
echo "[DONE]";

echo -n "Exporting icons.(3 of 4)..........................."          

LINKS=`find ./ -type l`
for file in $LINKS
do
	cp -f -p -R $file ../../$THEME/scalable/$file;
done

FILES=`find ./ -name *.svg -type f`
for file in $FILES
do
	cp -f -p $file ../../$THEME/scalable/$file;
done
cd ../../$THEME; 
echo "[DONE]";

echo -n "Creating 'tar.gz' package.(4 of 4).................";
cd ../ #moving out of the exporting directory
tar --create --gzip --file=$THEME.0.0.0.tar.gz $THEME            #create the .tar.gz package 

rm -R -f $THEME                                                         #remove the copied directory
echo  "[DONE]"; 
echo "Release creation process completed.";

echo;

exit 0
